package com.caipos.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.caipos.actor.common.data.Tenant;
import com.caipos.mapper.TenantMapper;
import com.caipos.service.TenantService;
import org.springframework.stereotype.Service;

import java.util.List;

//@Service("TenantDaoService")
@Service
public class TenantServiceImpl extends ServiceImpl<TenantMapper, Tenant> implements TenantService {
    @Override
    public Tenant getTenantById(String id) {
        return getById(id);
    }

    @Override
    public List<Tenant> getAllTenants() {
        return list();
    }

    @Override
    public IPage<Tenant> getTenantsByPage(Page<Tenant> page) {
        return baseMapper.selectPage(page, null);
    }

    @Override
    public boolean saveTenant(Tenant tenant) {
        return save(tenant);
    }

    @Override
    public boolean updateTenant(Tenant tenant) {
        return updateById(tenant);
    }

    @Override
    public boolean deleteTenantById(String id) {
        return removeById(id);
    }
}
